<?php
/*********************************************************************************
 * Copyright (C) 2017 CDEDUASK ChuangXinGongChang
 * All Rights Reserved.
 * 本软件为华育国际创新工场开发研制。未经本公司正式书面同意，其他任何个人、团体不得使用、复制、修改或发布本软件.
 *********************************************************************************/
/**
 * xxxxx
 * User: 蒋维
 * Date: 2017/7/25
 * Time: 9:09
 */


namespace app\home\controller;

use think\Controller;
use think\Db;

class ActualCombat extends Controller
{

   public function index(){
       $user=Db::table("carousel")->select();//查询carousel表
//        dump($user);//打印carousel表
       $this->assign('user',$user);//把数据放到前台
       if(isset($_GET["class_id"])){
           $class=Db::table("course_classification")->select();
           $course=Db::name("course_classification bg,course_classification_fine lg,course c")->
           field("c.id,c.category,c.record_name,c.introduce ,c.difficulty ,c.charge")->
           where("lg.category_id=bg.id and bg.id={$_GET["class_id"]} and c.category=lg.record_name")->paginate(9);
           $page=$course->render();
//        pre($course);
           return view("actual_combat" ,["page"=>$page,"course"=>$course,"class"=>$class]);
       }else {
           $class=Db::table("course_classification")->select();
           $course=Db::name("course ")
//           field("c.id,c.category,c.record_name,c.introduce ,c.difficulty ,c.charge")->
          ->paginate(9);
           $page=$course->render();
//        pre($course);
           return view("actual_combat" ,["page"=>$page,"course"=>$course,"class"=>$class]);
       }
   }
   }



